package com.iamalive;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.app.Activity;
import android.content.Intent;


public class OptionsActivity extends Activity {
	
	private Button mButtonListInfo;
	private Button mButtonAddInfo;
	private Button mButtonListRecipient;
	private Button mButtonRegisterNewRecipient;
	private Button mButtonUpdateMyDetails;
	private Button mButtonLogout;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_options);
		
		
		
		mButtonListInfo = (Button) findViewById(R.id.buttonOptionsListInfo);
		mButtonAddInfo = (Button) findViewById(R.id.buttonOptionsAddNewInfo);
		mButtonListRecipient = (Button) findViewById(R.id.buttonOptionsListRecipients);
		mButtonRegisterNewRecipient = (Button) findViewById(R.id.buttonOptionsRegisterRecipient);
		mButtonUpdateMyDetails = (Button) findViewById(R.id.buttonOptionsUpdateMyDetails);
		mButtonLogout = (Button) findViewById(R.id.buttonOptionsLogout);
		
		mButtonListInfo.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                onListInfoButtonClicked();
            }
        });
		
		mButtonAddInfo.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                onAddInfoButtonClicked();
            }
        });
		
		mButtonListRecipient.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                onListRecipientButtonClicked();
            }
        });
		
		mButtonRegisterNewRecipient.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                onRegisterNewRecipientButtonClicked();
            }
        });
		
		mButtonUpdateMyDetails.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                onUpdateMyDetailsButtonClicked();
            }
        });

		mButtonLogout.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                onLogoutButtonClicked();
            }
        });
	}
	
	private boolean fetchUserData() {
		return true;
	}
	
	private void onListInfoButtonClicked() {
		Intent i = new Intent(this, InfoListActivity.class);
	    startActivity(i);	
	}

	private void onAddInfoButtonClicked() {
		Intent i = new Intent(this, AddInfoActivity.class);
	    startActivity(i);
	}

	private void onListRecipientButtonClicked() {
		Intent i = new Intent(this, RecipientListActivity.class);
	    startActivity(i);
	}
	
	private void onRegisterNewRecipientButtonClicked() {
		Intent i = new Intent(this, RegisterNewRecipient.class);
	    startActivity(i);
	}
	
	private void onUpdateMyDetailsButtonClicked() {
		Intent i = new Intent(this, UpdateMyDetailsActivity.class);
		startActivity(i); 
	}
	
	
	
	private void onLogoutButtonClicked() {
		//TODO: logout
		
		finish();
	}
}
